float4x4 WorldViewProjection;

Texture xTexture;
sampler TextureSampler = sampler_state { texture = <xTexture>; magfilter = LINEAR; minfilter = LINEAR; mipfilter=LINEAR; AddressU = mirror; AddressV = mirror; };

float3 xLightDirection;
float xAmbient;

struct VertexShaderInput
{
    float4 Position		: POSITION0;
    float2 TexCoords	: TEXCOORD0;
    float3 Normal		: NORMAL;
};

struct VertexShaderOutput
{
    float4 Position		: POSITION0;
    float2 TexCoords	: TEXCOORD0;
    float LightingFac	: TEXCOORD1;
};

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
    VertexShaderOutput output;
    
    output.Position = mul(input.Position, WorldViewProjection);
    output.TexCoords = input.TexCoords;
    output.LightingFac = dot(input.Normal, -xLightDirection);

    return output;
}

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
    return tex2D(TextureSampler, input.TexCoords) * clamp(input.LightingFac + xAmbient, 0, 1); 
}

technique Scene
{
    pass Pass1
    {
        // TODO: set renderstates here.

        VertexShader = compile vs_1_1 VertexShaderFunction();
        PixelShader = compile ps_1_1 PixelShaderFunction();
    }
}
